#include "led.h"

uint8_t led_flag;
uint8_t people_flag;
uint8_t ledNum = 0x0f;

uint8_t led_mode = 0;
uint8_t motor_mode = 0;
uint8_t mode_update_flag = 0;

/**
 * @brief  灯控制
 * @param  
 * @retval 无
 */
void led_ctrl(void)
{
	if (led_mode == 0) {
			ledNum = 255 - (adc_driver.light / 100.0f * 255);
			ws_clear(ledNum<<16|ledNum<<8|ledNum);
	} else {
		ws_clear(ledNum<<16|ledNum<<8|ledNum);
	}
}

/**
 * @brief  灯控制
 * @param  
 * @retval 无
 */
void motor_ctrl(void)
{
	if (dht11_Data[2] > 25 || dht11_Data[0] > 70) {
		motor_setSpeed(200);
	} else {
		motor_setSpeed(0);
	}	
}

/**
 * @brief  检测人体
 * @param  
 * @retval 无
 */
void people_check(void)
{
	people_flag = HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_6);
}
/******************* (C) COPYRIGHT 2023 LIUGONG*****END OF FILE************/
